<?php
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
include_once("../controller/detail-log-add.php");
?>



<?
//用来判断当前系统属于什么板块
$detail=select_one_line_all_items($table_Prefix."renewal","nid = ".$_REQUEST['nid']."");
$renewal_history=select_lines_all_items($table_Prefix."renewal_log","next_enddate","parent_nid = ".$_REQUEST['nid']."","");
$relate_renewal=select_lines_all_items($table_Prefix."renewal","nid desc","unit = '".$detail['unit']."'","");
?>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
    <link href="../asset/css/css.css" rel="stylesheet" type="text/css"/>

</head>

<body>

<div id="topbar"><?php include ROOT_PATH_.'/controller/common/module/topbar.php'; ?></div>

<div id="container" class="renewal_log">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/module/sidebar.php'; ?>
        </div>


<div id="content">

    <!--标题设定-->
    <?php $page_title='项目资料';?>
    <?php include $_SERVER['DOCUMENT_ROOT'].'/controller/common/module/mod-page-title.php'; ?>




<div class="box layui-form main_left">


<form id="add-form" method="post"
      action="detail-log-add-function.php?nav-itemed=renewal"
      enctype="multipart/form-data"
      class="layui-form">


<input type="hidden" name="ai_parent_nid" value="<? echo $detail['nid']?>">

    <fieldset class="layui-elem-field layui-field-title">
        <legend> 基本信息 </legend>
    </fieldset>



<div class="layui-form-item">
    <label class="layui-form-label">续费内容</label>
    <div class="layui-input-block">
        <input type="text" name="ai_name" required  lay-verify="required"
               placeholder="请输入项目名称" autocomplete="off" class="layui-input"
               value="<? echo $detail['name']?> （<?echo $detail['type']?>）"
        disabled >
    </div>
</div>





    <?
    $unit_list=select_lines_all_items($table_Prefix."unit","nid desc","relation = '客户'","0");
    $unit=select_one_line_all_items($table_Prefix."unit","nid = '".$detail['unit']."'");
    ?>


    <div class="layui-form-item">
        <label class="layui-form-label">所属单位</label>

        <div class="layui-input-block">
            <input type="text"
                   placeholder="请输入项目名称" autocomplete="off" class="layui-input"
                   value="<? echo $unit['name']?>"
                   disabled >
        </div>


    </div>


    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="remark" disabled class="layui-textarea"><? echo $detail['remark']?></textarea>
        </div>
    </div>






    <div class="layui-form-item">
        <label class="layui-form-label">运行于</label>
        <div class="layui-input-block">
            <input type="radio" name="ai_location" value="arrow"   title="arrow"   <? if ($detail['location'] == "arrow") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="BOW"     title="BOW"   <? if ($detail['location'] == "BOW") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="crossbow"   title="crossbow"   <? if ($detail['location'] == "crossbow") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="dagger"   title="dagger"   <? if ($detail['location'] == "dagger") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="fork"   title="fork"   <? if ($detail['location'] == "fork") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="gun"   title="gun"   <? if ($detail['location'] == "gun") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="spear"    title="spear"   <? if ($detail['location'] == "spear") {echo "checked";} ?> >


            <input type="radio" name="ai_location" value="新网"        title="新网"   <? if ($detail['location'] == "新网") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="万网"        title="万网"   <? if ($detail['location'] == "万网") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="861.cn"      title="861.cn"   <? if ($detail['location'] == "龙名网") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="自备"        title="自备"   <? if ($detail['location'] == "自备") {echo "checked";} ?> >
            <input type="radio" name="ai_location" value="其他"        title="其他"   <? if ($detail['location'] == "其他") {echo "checked";} ?> >

        </div>
    </div>







    <div class="layui-form-item">
        <label class="layui-form-label">续费金额</label>
        <div class="layui-input-block">
            <input type="text" name="ai_sum"   autocomplete="off" class="layui-input"  value="<? echo $detail['sum']?>">
        </div>
    </div>





    <!--异步上传：选择图片时候已经处理好文件上传-->
    <div class="layui-form-item certificate">

    <label class="layui-form-label">凭证：</label>
        <div class="layui-input-block">
            <? include("module/mod-certificate-async-upload.php");?>
        </div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label">成本支出</label>
        <div class="layui-input-block">
            <input type="text" name="ai_cost"   autocomplete="off" class="layui-input"  value="<? echo $detail['cost']?>">
        </div>
    </div>








    <div class="layui-form-item">
        <label class="layui-form-label">付款日期</label>
        <div class="layui-input-block">
            <input type="text" name="ai_paydate" id="date" autocomplete="off"
                   class="layui-input laydate"  value="<?echo $detail['paydate']?>"
                   lay-verify="required" class="laydate-icon"
            >
        </div>
    </div>




    <div class="layui-form-item">
        <label class="layui-form-label">下次续费日期</label>
        <div class="layui-input-block">
            <input type="text" name="ai_next_enddate" id="date"
                   autocomplete="off" class="layui-input laydate laydate-icon"
                   value="<?echo
                   date('Y-m-d', strtotime ("+1 year", strtotime($detail['next_enddate'])));
                   ?>"
            >
        </div>
    </div>






    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="ai_remark" placeholder="备注" class="layui-textarea"></textarea>
        </div>
    </div>








    <?
    $employee_list=select_lines_all_items($table_Prefix."employee","nid desc","","0");
    ?>

    <div class="layui-form-item">
        <label class="layui-form-label">跟进客服</label>
        <div class="layui-input-block">
            <select name="ai_onduty" >
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
    </div>



    <input type="hidden" name="ai_type"   autocomplete="off" class="layui-input"  value="<? echo $detail['type']?>">





                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formMemberAdd" type="submit">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>


                    <input name="navitemed" type="hidden" value="<? echo $_REQUEST['nav-itemed'] ?>"/>
                    <input name="sys_part"  type="hidden" value="<? echo $system_part ?>"/>
                    <input name="nowpageid" type="hidden" value="<? echo $_REQUEST['nowpageid'] ?>"/>
                    <input name="sortby"    type="hidden" value="<? echo $_REQUEST['sortby'] ?>"/>
                    <input name="term_nid"  type="hidden" value="<? echo $_REQUEST['term_nid'] ?>"/>



</form>
 


 
 
        </div>


<div class="main_right">

    <fieldset class="layui-elem-field layui-field-title">
        <legend> 相关续费 </legend>
    </fieldset>


        <div class="log">
            <?
            for($i=0;$i<count($relate_renewal);$i++){ ?>
                <div class="loglist">
                    <div class="cost">续费项目：<? echo $relate_renewal[$i]['name']; ?> - <? echo $relate_renewal[$i]['type']; ?></div>
                    <div class="date">下次到期：<? echo $relate_renewal[$i]['next_enddate']; ?>  --  状态 <? echo $relate_renewal[$i]['status']; ?> </div>
                    <div class="content">备注：<? echo $relate_renewal[$i]['remark']; ?></div>
                </div>
            <? } ?>
        </div>



        <h1> 续费记录 </h1>
        <div class="log">
            <?
            for($i=0;$i<count($renewal_history);$i++){ ?>
                <div id="item<? echo $renewal_history[$i]['nid']; ?>"
                     class="loglist" style=" <? if($renewal_history[$i]['status']!="已审核"){echo "border-top:solid 4px #ff9900";}?>">
                    <?if(in_array("admin",$quanxian)){?>
                        <div class="function">
                            <? if($renewal_history[$i]['status']=="已审核"){?>
                                <span class="layui-btn layui-btn-mini"
                                      onclick="change_status('<? echo $renewal_history[$i]['nid']?>','<?echo $renewal_history[$i]['status']?>')">取消审核</span>
                            <?}?>
                            <? if($renewal_history[$i]['status']!="已审核"){?>
                                <span class="layui-btn layui-btn-mini" onclick="change_status('<? echo $renewal_history[$i]['nid']; ?>','<? echo $renewal_history[$i]['status']; ?>')">审核通过</span>
                                <!--                                <span class="layui-btn layui-btn-mini">修改</span>-->
                                <span class="layui-btn layui-btn-mini" onclick="delete_renewal_record(<? echo $renewal_history[$i]['nid']; ?>)">删除</span>
                            <?}?>

                        </div>
                    <?}?>
                    <div class="icon"><img width="100%" src="/uploadfiles/<? echo $renewal_history[$i]['certificate']; ?>"> </div>

                    <div class="cost">续费：<? echo $renewal_history[$i]['sum']; ?>  /  支出：- <? echo $renewal_history[$i]['cost']; ?></div>

                    <div class="date">付款日期：<? echo $renewal_history[$i]['paydate']; ?>  /  下次到期：<? echo $renewal_history[$i]['next_enddate']; ?></div>
                    <? if($renewal_history[$i]['remark']){?>
                        <div class="content">备注：<? echo $renewal_history[$i]['remark']; ?></div>
                    <?} ?>

                </div>
            <? } ?>
        </div>



    </div>



<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>







<script src="../asset/js/change_status.js"></script>
<script src="../asset/js/delete_renewal_log.js"></script>
<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>
</body>
</html>
